Skip to content

Conversation

@Avery-Dunn
Copy link

Deprecates the ability to send arbitrary query parameters to a token request according to KR 3310905, similar to what was done in other MSALs:
AzureAD/microsoft-authentication-library-for-dotnet#5536

AzureAD/microsoft-authentication-library-for-java#1001

This behavior was intended for niche scenarios which the library did not explicitly cover, and not really meant for production. It can affect the contents and validity of tokens but were not used in our caching scheme which led to bad caching behavior: if the extra query parameters changed between requests we could return tokens that were not valid for the latest set of parameters.

MSAL Python did not have an explicit WithExtraQueryParameters API like other MSALs, however the internal BaseClient._obtain_token and Client._obtain_token functions had a params argument which set the query parameters just like other MSALs. A customer could define these params by setting them in the kwargs argument of some public APIs.

This PR removes the explicit params argument from those functions. For backwards compatibility we still check the kwargs argument for params, and if it is used a deprecation warning in BaseClient._obtain_token will inform the customer.

@Avery-Dunn Avery-Dunn requested a review from a team as a code owner November 5, 2025 21:27
@Avery-Dunn Avery-Dunn changed the title Add a deprecation warning on the params field of _obtain_token Deprecate the params field of _obtain_token Nov 5, 2025
@rayluo
Copy link
Contributor

rayluo commented Nov 5, 2025

In Python, _name_with_leading_underscore is considered internal helpers. So, there is no need to alter this internal helper. (An analogy can be that neither of those counterpart PRs removes the query parameter from their underlying http helper functions, because they don't need to.) I would suggest we close this PR without any change.

@Avery-Dunn Avery-Dunn closed this Nov 6, 2025
@rayluo rayluo deleted the avdunn/deprecate-extraqp branch November 6, 2025 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants